<template>
  <div class="radio">


    <rodiolist :station="station"></rodiolist>
  </div>
</template>

<script setup lang="ts" name="radio">
import { onMounted, ref } from 'vue';
import axios from 'axios';
import { useRouter } from 'vue-router';
import { getBymonth } from '@/api/radio';
import rodiolist from './components/radioList.vue';

let station = ref();
let router = useRouter();


// 以（2024-12）格式获取当前时间
let getFormattedTime = () => {
  const date = new Date();
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0');
  return `${year}-${month}`;
};

onMounted(() => {
  // axios.get("https://apis.netstart.cn/one/find/bymonth/8/2024-12").then((res) => {
  //   // console.log(res.data.data);
  //   station.value = res.data.data;
  // });
  getBymonthData();

});
let getBymonthData = async () => {
  station.value = (await getBymonth(getFormattedTime())).data

}

</script>

<style scoped>
</style>